package com.lzy.netty.mq;


import com.lzy.pojo.netty.ChatMsg;
import com.lzy.utils.JsonUtils;


public class MessagePublisher {

    // 定义交换机
    public static final String EXCHANGE_NAME = "exchange_test";

    // 定义队列
    public static final String QUEUE_NAME = "queue_test";

    // 具体的路由地址
    public static final String ROUTING_KEY_WECHAT_MSG_SEND = "lzy.wechat.wechat.msg.send";

    public static void sendMsgToSave(ChatMsg msg) throws Exception {
        RabbitMQConnectUtils connectUtils = new RabbitMQConnectUtils();
        connectUtils.sendMsg(JsonUtils.objectToJson(msg),
                             EXCHANGE_NAME,
                             ROUTING_KEY_WECHAT_MSG_SEND);
    }


}
